﻿using System;
using System.Text.Json.Serialization;

namespace DimensionsHelper.Common.Contracts.DataCollector.Options;

/// <summary>
///     定义计算Gap时使用的阈值定义
/// </summary>
[Serializable]
public class Threshold : INamedObject
{
    /// <summary>
    ///     区间是否是闭区间，如果此值为true，则区间为闭区间，否则为开区间
    /// </summary>
    public bool IsClosed { get; set; } = true;

    /// <summary>
    ///     区间上限
    /// </summary>
    public double Upper { get; set; } = double.NaN;

    /// <summary>
    ///     区间下限
    /// </summary>
    public double Lower { get; set; } = double.NaN;

    public string Name { get; set; } = string.Empty;
}


[JsonConverter(typeof(JsonStringEnumConverter<ThresholdTestResult>))]
public enum ThresholdTestResult
{
    NaN,
    Greater,
    Exactly,
    Less
}